package isanfeng.tuxiaoer.pattern.structural.proxy.staticproxy;

import isanfeng.tuxiaoer.pattern.structural.proxy.IOrderService;
import isanfeng.tuxiaoer.pattern.structural.proxy.Order;
import isanfeng.tuxiaoer.pattern.structural.proxy.OrderServiceImpl;

/**
 * @author 李红辉
 * @version 1.0
 * @date 2019/10/14 11:13
 */
public class OrderServiceStaticProxy {

    private IOrderService iOrderService;

    public int saveOrder(Order order) {
        beforeMethod();
        iOrderService = new OrderServiceImpl();

        int effect = iOrderService.saveOrder(order);
        afterMethod();
        return effect;
    }

    private void beforeMethod() {
        System.out.println("静态代理， before");
    }

    private void afterMethod() {
        System.out.println("静态代理， after");
    }
}
